/******************************************************************************

	filename :  TileField.fx
	version  :  0.1
	author   :  Bernardo Z. Cinco Jr.
	date     :  July 19, 2010   
	
	Description:
	 > Tile field, either a text or a button.
		

******************************************************************************/

package mythesis.gui.tile;
import javafx.scene.*;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import javafx.scene.paint.Color;

public class TileField extends CustomNode
{
	public var booIsButton:Boolean;
	public var strLabel:String = "-def-";
	public var g:Group;
	public var arrAllowedTypes:Boolean[] = [false, false, false,				// Default:
											false, false, false,				// > Reject all types.
											false, false, false,
											false, false, false,
											false, false, false];
	
    var fonText = Font
    {
        size : 10;
    }
    
	public function laman(i:Integer)
	{
	    return g.content[i];
	}
    
    override function create():Node
    {
        if (booIsButton == false)
        {
            g = Group
            {
                content:
                [
         	    	Text
         	    	{
         	    	    fill    : Color.WHITE;
         	    	    font    : fonText;
         	    	    content : strLabel;
         	    	}
                ]
            }
         	return g;
        }
        
        else
        {
            g = Group
            {
                content:
                [
					TilePopupButton
					{
					    translateX      : 30;
					    strLabel        : strLabel;
					    arrAllowedTypes : arrAllowedTypes;
					}
                ]
            }
            
			return g;         
        }
        
    }
    
}